package com.avicit.zipkinkafkaesserver.jobs;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import zipkin2.dependencies.elasticsearch.ElasticsearchDependenciesJob;

@Component
public class DependenciesJob {

    @Value("${zipkin.storage.elasticsearch.hosts}")
    private String zipkinEsHosts;
    /**
     * 定时任务，跑出依赖链路（服务）
     */
    //一分钟执行一次
//    @Scheduled(cron = "${job.corn.dependencies}")
    public void zipkinDependencies() {
        ElasticsearchDependenciesJob
                .builder().hosts(zipkinEsHosts).index("zipkin")
                .build()
                .run();
    }
}
